const express = require('express')
const router = express.Router()
const {
    middleCheckAccess,
    getAllSurvey,
    getDeletedSurvey,
    toggleSurveyOver,
    createSurvey,
    delSurvey,
    restoreSurvey,
    statAnswer,
    getSurvey,
    replaceAnswer,
    delAnswer,
} = require('./admin.func.js')

router.use(middleCheckAccess)

router.get('/survey/all', getAllSurvey)
router.get('/survey/deleted', getDeletedSurvey)
router.post('/survey/toggle_over', toggleSurveyOver)
router.post('/survey/create', createSurvey)
router.post('/survey/delete', delSurvey)
router.post('/survey/restore', restoreSurvey)
router.get('/survey/stat/:id', statAnswer)
router.get('/survey/:id', getSurvey)

router.post('/answer/replace', replaceAnswer)
router.post('/answer/delete', delAnswer)

module.exports = router
